// @ts-nocheck
import {createStore, applyMiddleware, compose } from 'redux';
import reducer from './reducer';
// import thunk from 'redux-thunk'
import createSagaMiddleware from 'redux-saga'
import mySages from './sagas'
//创建中间件
const sagaMiddleware = createSagaMiddleware()

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose

const enhancer = composeEnhancers(applyMiddleware(sagaMiddleware))

//craeteStore 第二个参数，是配置redux Dev tools
const store = createStore(reducer,enhancer)
//需要run 将中间件运行起来
sagaMiddleware.run(mySages)
export default store